-- attack_startle
-- created by wangy
-- 攻击附加惊吓

return {
    apply = function(prop, baseValue)
        return baseValue;
    end,

    -- 攻击触发
    trigger = function(who, prop, arg)
        local target = arg;
        -- 概率触发

        -- 如果是boss
        if target:isBoss() then
             return;
        end

        local rand = DungeonM.getRandSeed("attack_startle") % 1000;
        if (rand > prop[3]) then
            return;
        end

        -- 持续时间，默认为3轮
        local effectRound = CombatM.getRound() + 3;
        -- 血量减少
        local currHp = target:getHp("hp");
        local statusHp = 1;
        target:setRealHp(statusHp);

        local reduceHp = currHp - statusHp;

        -- 量子状态
        local condition = {
            ["hp"] = statusHp,
            ["reduce"] = reduceHp,
            ["end_round"] = effectRound,
        };

        -- 附加状态
        CombatStatusM.applyStatus(target, "startle", condition);

        return arr;
    end,

    record = function(target, prop, path)
        return false;
    end
};
